package com.haierp.util;

import java.io.IOException;
import java.util.Properties;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

public class PropertiesUtils {

    private static Properties single=null;
    //静态工厂方法
    public static Properties getProperties() {
        if (single == null) {
            ClassPathResource resource = new ClassPathResource("config/application.properties");
            try {
                single = PropertiesLoaderUtils.loadProperties(resource);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return single;
    }
}

